﻿using System.ComponentModel;
using NthDownload.Common.Mapping;
using System.Security;

namespace NthDownload.DownloadPlugins.Http
{
    [MappableObject]
    public class HttpCredentials : INotifyPropertyChanged
    {
        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion INotifyPropertyChanged

        #region Class Members

        private string _domain;
        private string _username;
        private string _password;

        #endregion Class Members

        #region Properties

        /// <summary>
        /// The domain the credentials apply to
        /// </summary>
        [MappableProperty]
        public string Domain
        {
            get
            {
                return _domain;
            }
            set
            {
                _domain = value;
                OnPropertyChanged("Domain");
            }
        }

        /// <summary>
        /// Username component of the credentials
        /// </summary>
        [MappableProperty]
        public string Username
        {
            get
            {
                return _username;
            }
            set
            {
                _username = value;
                OnPropertyChanged("Username");
            }
        }

        /// <summary>
        /// Password component of the credentials
        /// </summary>
        [MappableProperty]
        public string Password
        {
            get
            {
                return _password;
            }
            set
            {
                _password = value;
                OnPropertyChanged("Password");
            }
        }

        #endregion Properties
    }
}
